package cn.tedu.classx;

public class Student {
    int sid;//学号
    String name;//姓名
    int age;//年龄
    //定义无参构造
    public Student(){
        System.out.println("Student的无参构造");
    }
    //定义有参构造 三个参数
    public Student(int sid,String name,int age){
        //调用当前类的其他的构造方法--this语句
        this(name,age);
        //System.out.println("形参值为："+name);
        //System.out.println(id+","+n+","+a);
        this.sid = sid;//学号赋值
//        this.name = name;
//        this.age = age;

    }
    //定义有参构造 两个参数
    public Student(String name,int age){
        //this();//调用无参构造
        this.name = name;
        this.age = age;
    }
    public void study(){
        String name = "a";
        System.out.println("好好学习 天天向上！"+this.name);
        this.play();
    }
    public void play(){
        System.out.println("玩");
        method(this);//this作为参数来使用
    }
    //参数Student  返回值Student
    public Student method(Student stu1){//586
        stu1.name = "丽丽";
        return stu1;
//        return this;//this:调用method的对象
    }
}
